home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Demo / md5test / md5driver.py < prev    next >
Encoding:
Text File  |  1994-10-08  |  2.1 KB  |  32 lines  |  [TEXT/R*ch]

  1. import string
  2.  
  3. def MDPrint(str):
  4.     outstr = ''
  5.     for i in str:
  6.         o = ord(i)
  7.         outstr = outstr \
  8.               + string.hexdigits[(o >> 4) & 0xF] \
  9.               + string.hexdigits[o & 0xF]
  10.     print outstr,
  11.     
  12.  
  13. from time import time
  14.  
  15. def makestr(start, end):
  16.     result = ''
  17.     for i in range(start, end + 1):
  18.         result = result + chr(i)
  19.  
  20.     return result
  21.     
  22.  
  23. from md5 import md5
  24.  
  25. def MDTimeTrial():
  26.     TEST_BLOCK_SIZE = 1000
  27.     TEST_BLOCKS = 10000
  28.  
  29.     TEST_BYTES = TEST_BLOCK_SIZE * TEST_BLOCKS
  30.  
  31.     # initialize test data, need temporary string filler